#pragma once

// forward declare
class EntBase;

class TimedCallbackData
{
public:
	S32						m_s32TimeStampMs;			// time stamp in ms of game time
	irr::core::stringc		m_pfuncCallbackFunction;	// script function to call
};


// Classes
class Scripting
{
public:
	//=== constructor ===//
	Scripting();
	//=== destructor ===//
	~Scripting();

	//! intitialize scripting engine
	RCODE Startup( void );
	//! shutdown scripting engine
	RCODE Shutdown( void );

	//! reset
	void Reset();
	//! load script file
	RCODE LoadFile( const irr::core::stringc& strFile );

	//! set a variable value within the scripting enviroment
	void DefineSquirrelVariable(const char * pVariableName, const char * pValue );
	//! call a script function
	void CallFunction( const irr::core::stringc& strFunctionName );
	//! call scripted collision handler
	void CallCollisionHandler(	const irr::core::stringc&	strFunctionName, 
								EntBase * poEntBase, 
								EntBase * poEntOther );
	//! call scripted zone handler
	void CallZoneHandler(	const irr::core::stringc& strFunctionName, 
							int Type, 
							EntBase * poEntZone, 
							EntBase * poEntOther );
	//! handle key press events
	bool HandleKeyPress( irr::EKEY_CODE eKey );
	//! handle mouse press events
	void HandleMousePress( int iButton, int iMouseX, int iMouseY );
	//! call time based callbacks
	void UpdateTimedCallbacks( void );

private:
/*
	static luaL_reg CameraFunctions[], ObjectFunctions[], OrbFunctions[], TimerFunctions[], LevelFunctions[],
					GUIFunctions[], RandomFunctions[], ZoneFunctions[];

	static bool CheckArguments(lua_State *LuaObject, int Required);

	static int CameraSetYaw(lua_State *LuaObject);
	static int CameraSetPitch(lua_State *LuaObject);

	static int ObjectGetPointer(lua_State *LuaObject);
	static int ObjectGetName(lua_State *LuaObject);
	static int ObjectSetPosition(lua_State *LuaObject);
	static int ObjectGetPosition(lua_State *LuaObject);
	static int ObjectStop(lua_State *LuaObject);
	static int ObjectSetAngularVelocity(lua_State *LuaObject);
	static int ObjectSetLifetime(lua_State *LuaObject);
	static int ObjectDelete(lua_State *LuaObject);

	static int OrbDeactivate(lua_State *LuaObject);

	static int TimerDelayedFunction(lua_State *LuaObject);
	static int TimerStamp(lua_State *LuaObject);

	static int LevelLose(lua_State *LuaObject);
	static int LevelWin(lua_State *LuaObject);
	static int LevelGetTemplate(lua_State *LuaObject);
	static int LevelCreateObject(lua_State *LuaObject);
	static int LevelCreateConstraint(lua_State *LuaObject);
	static int LevelCreateSpring(lua_State *LuaObject);

	static int GUITutorialText(lua_State *LuaObject);

	static int RandomSeed(lua_State *LuaObject);
	static int RandomGetFloat(lua_State *LuaObject);
	static int RandomGetInt(lua_State *LuaObject);
	
	void AddTimedCallback(const stringc & strFunctionName, float Time);
	void AttachKeyToFunction(EKEY_CODE Key, const stringc & strFunctionName);
	
	list<TimedCallbackStruct> TimedCallbacks;

	std::map<EKEY_CODE, stringc> KeyCallbacks;
	std::map<EKEY_CODE, stringc>::iterator KeyCallbacksIterator;

	lua_State *LuaObject;
	*/
};

extern Scripting g_ScriptingImp;
